<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <#include "/comm/module-edit.ftl"/>
</head>
<style type="text/css">

</style>
<body>
<div class="layui-div-body">
    <div class="layui-fluid layui-div-edit">
        <form class="layui-form layui-form-pane" autocomplete="off">
            <div class="layui-form-item">
                <label class="layui-form-label">编码</label>
                <div class="layui-input-inline">
                    <input type="text" name="code" placeholder="请输入编码" class="layui-input" value="${info.code!}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">父级ID</label>
                <div class="layui-input-inline">
                    <div id="parentCode" initValue="${info.parentCode!}"></div>

                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" placeholder="请输入名称" class="layui-input" value="${info.name!}">
                </div>
            </div>

            <div class="layui-form-item">
                <button class="layui-btn" lay-submit="" lay-filter="save">立即提交
                </button>
                <#if info._id ==''>
                    <button type="reset" class="layui-btn layui-btn-primary" id="btn-reset">重置</button>
                </#if>
                <input type="hidden" id="_id" name="_id" value="${info._id}"/>
            </div>
        </form>
    </div>
</div>
<script>
    layui.config({
        base: '${request.contextPath}/assets/lib/' //静态资源所在路径
    }).extend({
        combotree: 'combotree',
        edit: 'edit',
    });
    layui.use(['edit', 'combotree'], function () {
        let edit = layui.edit, $ = layui.$, combotree = layui.combotree;
        edit.render()
        combotree.render({
            id: 'parentCode',
            elem: '#parentCode',
            isMultiple: false,
            expandLevel: 2,
            yChkboxType: 's',
            nChkboxType: 's',
            ajaxUrl: "${request.contextPath}/platform/area/tree",
            placeholder: "请选择父级节点",
            // layVerify: 'required'
        });
        $('#btn-reset').on('click', function () {
            combotree.setValue('parentCode', "")
        });

    });
</script>
</body>

</html>
